package com.neouton.crm.executiceManager.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.neouton.common.entity.ActivitiVO;
import com.neouton.crm.entity.SysUserEntity;
import com.neouton.crm.executiceManager.entity.ManagerPurchaseOrderProductVO;
import com.neouton.crm.executiceManager.entity.ManagerPurchaseOrderVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface ManagerPurchaseOrderMapper {

    /**
     * 分页查询综管采购数据
     *
     * @param page
     * @param entity
     * @return
     */
    IPage<ManagerPurchaseOrderVO> queryPurchaseOrdesByPage(@Param("page") IPage page,
                                                           @Param("vo") ManagerPurchaseOrderVO entity,
                                                           @Param("userList") List<SysUserEntity> userList);


    List<ManagerPurchaseOrderVO> queryPurchaseOrdes(@Param("vo") ManagerPurchaseOrderVO entity,
                                                    @Param("userList") List<SysUserEntity> userList);
    /**
     * 获取当日最大采购单号
     * @return
     */
    Integer getPurchaseOrdeMaxNumByDate();

    /**
     * 保存采购单
     */
    Boolean savePurchaseOrder(@Param("purchaseOrder") ManagerPurchaseOrderVO purchaseOrder);


    Boolean savePurchaseOrderProduct(@Param("products") List<ManagerPurchaseOrderProductVO> purchaseOrderProducts,
                                     @Param("purchaseOrderId") Integer PurchaseOrderId);


    Boolean updatePurchaseOrder(@Param("purchaseOrder") ManagerPurchaseOrderVO purchaseOrder);

    /**
     * 备份采购数据
     * @param purchaseOrder
     * @return
     */
    Boolean backUpPurchaseOrder(@Param("purchaseOrder") ManagerPurchaseOrderVO purchaseOrder);

    /**
     * 更具采购单ID获取采购信息
     * @param purchaseOrdeId
     * @return
     */
    ManagerPurchaseOrderVO getPurchaseOrdeInfoById(@Param("purchaseOrdeId") Integer purchaseOrdeId);

    /**
     * 通过审批ID查询现有数据
     * @param approvalId
     * @return
     */
    ManagerPurchaseOrderVO queryPurchaseOrderByApprovalId(Integer approvalId);

    /**
     * 通过审批ID查询现有数据
     * @param approvalId
     * @return
     */
    ManagerPurchaseOrderVO queryPurchaseOrderHistoryByApprovalId(Integer approvalId);

    List<ManagerPurchaseOrderVO> queryALLPurchaseOrders();

    Boolean deletePurchaseOrderById(Integer purchaseOrdeId);

    /**
     * 分页查询
     *
     * @param page
     * @param entity
     * @return
     */
    IPage<ManagerPurchaseOrderVO> queryApprovalPurByPage(@Param("page") IPage page,
                                                  @Param("vo") ManagerPurchaseOrderVO entity,
                                                  @Param("activitis") List<ActivitiVO> activitiVOS);

    /**
     * 分页查询
     *
     * @param page
     * @param entity
     * @return
     */
    IPage<ManagerPurchaseOrderVO> queryApprovalPurDoneByPage(@Param("page") IPage page,
                                                      @Param("vo") ManagerPurchaseOrderVO entity);

    /**
     * 分页查询
     *
     * @param page
     * @param entity
     * @return
     */
    IPage<ManagerPurchaseOrderVO> queryApprovalPurRecordByPage(@Param("page") IPage page,
                                                        @Param("vo") ManagerPurchaseOrderVO entity,
                                                        @Param("userList") List<SysUserEntity> userList);
}
